#include <stdio.h>

int main() {
	int a[5][5], m, n;
	for (m = 0; m < 5; m++)
		for (n = 0; n < 5; n++) {
			if (m == n)
				a[m][n] = 1;
			else if (m > n)
				a[m][n] = 6 - m + n;
			else
				a[m][n] = n - m + 1;
		}
	for (m = 0; m < 5; m++) {
		for (n = 0; n < 5; n++)
			printf("%d\t", a[m][n]);
		printf("\n");
	}
}